<?php
    // +----------------------------------------------------------------------
    // | 用户私信聊天记录
    // +----------------------------------------------------------------------
    // | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
    // +----------------------------------------------------------------------
    // | Author: 微尘 <yicmf@qq.com>
    // +----------------------------------------------------------------------
    namespace app\model\pos;

    use app\model\app\Device;
    use app\model\ucenter\IpPool;
	use app\model\ucenter\User;
    use app\event\im\Chat as ChatEvent;
    use think\model\concern\SoftDelete;

    class PosTransfer extends Common
    {
        use SoftDelete;
        public function user()
        {
            return $this->belongsTo(User::class);
        }
       public function toUser()
        {
            return $this->belongsTo(User::class,'to_user_id');
        }

       public function posLevel()
        {
            return $this->belongsTo(PosLevel::class);
        }

        /**
         * 写入修改
         * @param $data
         */
        public static function onBeforeInsert($data)
        {
            $data['ip'] = !empty($data['ip']) ? $data['ip'] : self::$request->ip();
            $data['status'] = 1;
        }
        protected $type = [
            'pos_sn'=>'array'
        ];
    }
